import App from './App'
import uviewPlus from '@/uni_modules/uview-plus'

import io from '@hyoga/uni-socket.io';
// socket连接及操作
const socket = io('http://127.0.0.1:4000/my-chatroom', {
	transports: ['websocket', 'polling'],
	timeout: 5000,
})

// 初始化
socket.on('connect', () => {
	let personId = uni.getStorageSync('info').personId
	// 注册在线用户
	socket.emit('online', personId, 1)
})



import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	app.use(uviewPlus)
	app.config.globalProperties.$socket = socket
	return {
		app
	}
}
